import 'dart:convert';

JokeModel jokeModelFromJson(String jsonString) => JokeModel.fromJson(json.decode(jsonString));

String jokeModelToJson(JokeModel data) => json.encode(data.toJson());

class JokeModel {
  JokeModel({this.data});

  final List<Joke>? data;

  factory JokeModel.fromJson(Map<String, dynamic> json) {
    var list = json['data'] as List;
    List<Joke> dataList = list.map((i) => Joke.fromJson(i)).toList();

    return JokeModel(data: dataList);
  }

  Map<String, dynamic> toJson() {
    return {
      'data': data?.map((joke) => joke.toJson()).toList(),
    };
  }
}

class Joke {
  final String? content;
  final String? hashId;
  final int? unixtime;
  final String? updatetime;

  Joke({
     this.content,
     this.hashId,
     this.unixtime,
     this.updatetime,
  });

  factory Joke.fromJson(Map<String, dynamic> json) {
    return Joke(
      content: json['content'] as String?,
      hashId: json['hashId'] as String?,
      unixtime: json['unixtime'] as int?,
      updatetime: json['updatetime'] as String?,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'content': content,
      'hashId': hashId,
      'unixtime': unixtime,
      'updatetime': updatetime,
    };
  }
}